import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';

part 'cart_item_model.g.dart';

@JsonSerializable()
class CartItemModel extends Equatable {
  CartItemModel({
    required this.goodsId,
    required this.title,
    required this.quantity,
    this.isSelected = true,
    required this.productImageUrl,
    required this.configuration,
    required this.price,
  });

  String goodsId;
  String title;
  int quantity;
  bool isSelected;
  String productImageUrl;
  String configuration;
  double price;

  factory CartItemModel.fromJson(Map<String, dynamic> json) =>
      _$CartItemModelFromJson(json);

  Map<String, dynamic> toJson() => _$CartItemModelToJson(this);

  @override
  List<Object?> get props => [goodsId];

  @override
  bool? get stringify => true;
}
